package com.xzs.kit.base.exception;

/**
 * @author : Victor.Xiao
 * @date : 2017/12/12 15:40
 * @description :
 */
public class ServiceException extends RuntimeException  {

    private String errCode = ErrorCode.CODE_ERROR.getCode();
    private String errMsg = ErrorCode.CODE_ERROR.getMessage();


    public ServiceException(String errMsg, Throwable throwable) {
        super(errMsg, throwable);
    }

    public ServiceException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.errCode = errorCode.getCode();
        this.errMsg = errorCode.getMessage();
    }

    public ServiceException(ErrorCode errorCode, Throwable throwable) {
        super(errorCode.getEnMessage(), throwable);
        this.errCode = errorCode.getCode();
        this.errMsg = errorCode.getMessage();
    }

    public ServiceException(String errCode, String errMsg, Throwable throwable) {
        super(errMsg, throwable);
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public String getErrCode() {
        return errCode;
    }

    public String getErrMsg() {
        return errMsg;
    }

}
